﻿@model JewererBasic.ORDER_TREE_DETAIL
<h2></h2>


@using (Html.BeginForm())
{
    @Html.HiddenFor(m => m.Order_Tree_Detail_Id)
    @Html.HiddenFor(m => m.Order_Tree_Id)
    @Html.HiddenFor(m => m.Finish)
    <fieldset>
        @if (Model.Finish == -1)
        {
            <a href='@Url.Action("Detail", "TreeOrder", new { id = Model.Order_Tree_Id })'>
                <input type="button" value="Back" />
            </a>
            <input type="submit" name="submit" value="Save" />
            
            <fieldset>
                <legend>Tree Detail</legend>
                @*<p><strong class="myStrong" style="font-size: 20px">Tree Detail</strong></p>*@
                <table>
                    <tr>
                        <td>
                            <table class="table head">
                                <tr>
                                    <th style="width: 100px">Tree code</th>
                                    <th style="width: 200px">Component Id</th>
                                    <th style="width: 150px">WorkerId</th>
                                    <th style="width: 150px">Export Weight</th>
                                    <th style="width: 300px">Bags</th>
                                </tr>
                                <tr>
                                    <td style="text-align: center">
                                        @Html.DisplayFor(m => m.Order_Tree_Detail_Id)
                                    </td>
                                    <td style="text-align: center">
                                        @Html.EditorFor(model => model.Component_Id)
                                        @Html.ValidationMessageFor(model => model.WorkerId)
                                    </td>
                                    <td style="text-align: center">
                                        @Html.DropDownListFor(m => m.WorkerId, new SelectList(ViewBag.Workers, "Id", "Staff_Id"), new { id = "ddlStaffId" })
                                        @*@Html.EditorFor(model => model.WorkerId)
                            @Html.ValidationMessageFor(model => model.WorkerId)*@
                                    </td>
                                    <td style="text-align: center">
                                        @Html.EditorFor(model => model.ExportWeight)
                                        @Html.ValidationMessageFor(model => model.ExportWeight)
                                    </td>
                                    <td style="text-align: center">
                                        @Html.TextAreaFor(model => model.ListBag, new { rows = 5 })
                                        @Html.ValidationMessageFor(model => model.ListBag)
                                    </td>

                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </fieldset>
            
            <input type="submit" name="submit" value="Export" />
        }
        else if (Model.Finish == 0)
        {
            @Html.HiddenFor(m => m.Component_Id)
            @Html.HiddenFor(m => m.ExportWeight)
            @Html.HiddenFor(m => m.ListBag)   
            @Html.HiddenFor(m => m.WorkerId)

            <input type="submit" name="submit" value="Save" />
            <fieldset>
                <p class="myP">
                    Return Weight:
        @Html.TextBoxFor(m => m.ReturnWeight, new { @required = "required" })
                    @Html.ValidationMessageFor(m => m.ReturnWeight)
                    Dust Weight:
        @Html.TextBoxFor(m => m.RejectWeight, new { @required = "required" })
                    @Html.ValidationMessageFor(m => m.RejectWeight)
                </p>
                @*<p><strong class="myStrong" style="font-size: 20px">Tree Detail</strong></p>*@
                <table>
                    <tr>
                        <td>
                            <table class="table head">
                                <tr>
                                    <th style="width: 100px">Tree code</th>
                                    <th style="width: 150px">WorkerId</th>
                                    <th style="width: 300px">Bags</th>
                                    <th style="width: 150px">Export Weight</th>
                                </tr>
                                <tr>
                                    <td style="text-align: center">
                                        @Html.DisplayFor(m => m.Order_Tree_Detail_Id)
                                    </td>
                                    <td style="text-align: center">
                                        @Html.DisplayFor(m => m.EMPLOYEE.Staff_Id)
                                    </td>
                                    <td style="text-align: center">
                                        @Html.DisplayFor(m => m.ListBag)
                                    </td>
                                    <td style="text-align: center">
                                        @Html.DisplayFor(m => m.ExportWeight)
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </fieldset>
            <input type="submit" name="submit" value="Finish" />    
    
        }
        else if (Model.Finish == 1)
        {
            @Html.HiddenFor(m => m.Component_Id)
            @Html.HiddenFor(m => m.ExportWeight)
            @Html.HiddenFor(m => m.ListBag)   
            @Html.HiddenFor(m => m.ReturnWeight)
            @Html.HiddenFor(m => m.RejectWeight)
            @Html.HiddenFor(m => m.WorkerId)
@*<p><strong class="myStrong" style="font-size: 20px">Tree Detail</strong></p>*@
            <table>
                <tr>
                    <td>
                        <table class="table head">
                            <tr>
                                <th style="width: 100px">Tree code</th>
                                <th style="width: 150px">WorkerId</th>
                                <th style="width: 300px">Bags</th>
                                <th style="width: 150px">Export Weight</th>
                                <th style="width: 150px">Return Weight</th>
                                <th style="width: 150px">Dust Weight</th>
                            </tr>
                            <tr>
                                <td style="text-align: center">
                                    @Html.DisplayFor(m => m.Order_Tree_Detail_Id)
                                </td>
                                <td style="text-align: center">
                                    @Html.DisplayFor(m => m.WorkerId)
                                </td>
                                <td style="text-align: center">
                                    @Html.DisplayFor(m => m.ListBag)
                                </td>
                                <td style="text-align: center">
                                    @Html.DisplayFor(m => m.ExportWeight)
                                </td>
                                <td style="text-align: center">
                                    @Html.DisplayFor(m => m.ReturnWeight)
                                </td>
                                <td style="text-align: center">
                                    @Html.DisplayFor(m => m.RejectWeight)
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        }

    </fieldset>
}
@section Scripts{
    <script type="text/javascript">

    </script>
}